$.ajax({//请求登录页处理
    url: "http://chst.vip:1234/api/getinlanddiscount",
    success: function(res) {//登录成功后返回的数据
        console.log(res);
        let goods = document.getElementById("goods");
    // console.log(goods);

    //得到页面的dom元素
    for (let i = 0; i < res.result.length; i++) {
        let li = document.createElement("li");
        let a = document.createElement("a");
        
        // let img01 = document.createElement("img");
        let img = `${res.result[i].productImg}`
            // console.log(img01);s
        let title = document.createElement("h5");
        let price = document.createElement("p");
        let from = document.createElement("span");

        title.innerHTML = res.result[i].productName;
        price.innerHTML = res.result[i].productPrice;
        from.innerHTML = `${res.result[i].productFrom}  ${res.result[i].productTime}`;

        a.innerHTML = img;
        a.appendChild(title);
        a.appendChild(price);
        a.appendChild(from);
        li.appendChild(a);

        goods.appendChild(li);
        // console.log(goods.children);
        // goods.children[i].index = i;
        goods.children[i].onclick = function() {
            // console.log(res.result[i]);
            localStorage.setItem('proId', res.result[i].productId.toString());
            // console.log(localStorage.getItem('proId'));
            location.href = 'inlandtiao.html'
        }
    }
    
    }
})



let goTOP = document.getElementById('goTop');
goTOP.onclick = function() {
    document.documentElement.scrollTop = 0
    
}